package com.briup.pts.web.controller;

import com.briup.pts.config.response.Result;
import com.briup.pts.service.UploadService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Tag(name = "文件上传模块")
@RestController
@RequiredArgsConstructor
public class UploadController {

    private final UploadService uploadService;

    @Operation(summary = "文件上传接口")
    @PostMapping("/file/upload")
    public Result<String> upload(@RequestPart MultipartFile file){
        String url = uploadService.upload(file);
        return Result.success(url);
    }
}